# $Id: PKGBUILD 85355 2013-03-01 10:32:31Z andrea $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
# Contributor: William Rea <sillywilly@gmail.com>

pkgname=gpsbabel
pkgver=1.4.4
pkgrel=2
pkgdesc="Reads, writes, and manipulates GPS waypoints in a variety of formats"
arch=('i686' 'x86_64')
url="http://www.gpsbabel.org"
license=('GPL')
depends=('libusb-compat' 'expat')
makedepends=('fop' 'qt4' 'libxml2' 'libxslt' 'gtk2' 'lcms2' 'qtwebkit' 'java-environment' 'docbook-xsl')
optdepends=('qt4' 'qtwebkit')
options=('docs')
source=("gpsbabel-$pkgver.tar.gz::http://archlinux-stuff.googlecode.com/files/gpsbabel-$pkgver.tar.gz")
md5sums=('6c4c8f0cb9fcf9f8302585148878f174')

build() {
  cd $srcdir/gpsbabel-$pkgver
  ./configure --prefix=/usr
  make
  make doc
  (cd gui && qmake && make)
}

package() {
  cd $srcdir/gpsbabel-$pkgver
  make DESTDIR=$pkgdir install

  # GUI
  install -Dm755 gui/objects/gpsbabelfe-bin ${pkgdir}/usr/bin/gpsbabelfe-bin
  install -Dm644 gui/images/appicon.png $pkgdir/usr/share/pixmaps/gpsbabel.png
  install -Dm644 gui/gpsbabel.desktop $pkgdir/usr/share/applications/gpsbabel.desktop

  # Header install
  mkdir -p $pkgdir/usr/include/gpsbabel
  cp {defs.h,queue.h,gbtypes.h,filterdefs.h,cet.h,cet_util.h,garmin_tables.h} \
     $pkgdir/usr/include/gpsbabel

  # Doc install
  mkdir -p $pkgdir/usr/share/doc/$pkgname
  cp -r $srcdir/babelweb/* $pkgdir/usr/share/doc/$pkgname/
  cp README* $pkgdir/usr/share/doc/$pkgname/
}
